(event-basic-type): New function.
authorRichard M. Stallman <rms@gnu.org>
Mon, 8 Mar 1993 00:07:53 +0000 (00:07 +0000)
committerRichard M. Stallman <rms@gnu.org>
Mon, 8 Mar 1993 00:07:53 +0000 (00:07 +0000)
lisp/subr.el

index 5f30e0bd96cc6b286e742be5a18633c0baa8ae8c..a8533e19b0b4840ceccd6c9adcea89140f528df8 100644 (file)
@@ -244,6 +244,14 @@ See also the function `event-modifier-bits'."
            (setq list (cons 'alt list)))
        list))))
 
+(defun event-basic-type (event)
+  "Returns the basic type of the given event (all modifiers removed).
+The value is an ASCII printing character (not upper case) or a symbol."
+  (if (symbolp event)
+      (car (get event 'event-symbol-elements))
+    (let ((base (logand event (1- (lsh 1 18)))))
+      (downcase (if (< base 32) (logior base 64) base)))))
+
 (defmacro save-match-data (&rest body)
   "Execute the BODY forms, restoring the global value of the match data."
   (let ((original (make-symbol "match-data")))